import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/mes-product/key/material/config/page',
    method: 'post',
    data: {
      ...params,
      current,
      size
    }
  });
};

export const getDetail = (id) => {
  return request({
    url: '/api/mes-product/key/material/config/detail',
    method: 'get',
    params: {
      id
    }
  });
};

export const getDetailByPartNo = (productPartNo) => {
  return request({
    url: '/api/mes-product/key/material/config/get-detail',
    method: 'get',
    params: {
      productPartNo
    }
  });
};

export const remove = (ids) => {
  return request({
    url: '/api/mes-product/key/material/config/remove',
    method: 'get',
    params: {
      ids
    }
  });
};

export const addOrUpdate = (row) => {
  return request({
    url: '/api/mes-product/key/material/config/submit',
    method: 'post',
    data: row
  });
};

export const getStationList = (partMasterId) => {
  return request({
    url: '/api/mes-product/process/route/id',
    method: 'get',
    params: {
      partMasterId
    }
  });
};

export const getValidateSationList = (partNo) => {
  return request({
    url: '/api/mes-product/process/product-route/get-by-part-no',
    method: 'get',
    params: {
      partNo
    }
  });
};

export const getAllSection = () => {
  return request({
    url: '/api/mes-product/work-section/all-section',
    method: 'get'
  });
};

export const getWorkSectionByPartId = (partId) => {
  return request({
    url: '/api/mes-product/process/work-section/getByPartId',
    method: 'get',
    params: {
      partId
    }
  });
};

export const getSectionByPartId = (id) => {
  return request({
    url: '/api/mes-product/part-master-section/get-by-part',
    method: 'get',
    params: {
      partId: id
    }
  });
};

export const getWarehouseList = () => {
  return request({
    url: '/api/mes-warehouse/warehouse/list?type=LINE_SIDE',
    method: 'get'
  });
};

export const getAllWorkSection = () => {
  return request({
    url: '/api/mes-product/work-section/all-section',
    method: 'get'
  });
};

export const getConfiguration = (params) => {
  return request({
    url: '/api/mes-product/material/process/configuration/sectionId',
    method: 'get',
    params: params
  });
};

export const materialProcessSubmit = (data) => {
  return request({
    url: '/api/mes-product/material/process/configuration/batch/submit',
    method: 'post',
    data: data
  });
};

export const materialProcessRemove = (ids) => {
  return request({
    url: '/api/mes-product/material/process/configuration/remove',
    method: 'post',
    params: {
      ids
    }
  });
};

export const getMaterialProcessAll = (params) => {
  return request({
    url: '/api/mes-product/material/process/configuration/select/all',
    method: 'get',
    params: params
  });
};
